package com.ctshk.rpc.order.goods.mapper.provider;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ctshk.rpc.goods.dto.CommodityLogDTO;
import com.ctshk.rpc.goods.req.CommodityLogPageReq;
import org.apache.ibatis.jdbc.SQL;

/**
 * 商品日志-分页列表查询
 * @author 姜斌文
 * @since 2021-05-17
 */
public class CommodityLogProvider {
    public String findCommodityLogPageByCondition(IPage<CommodityLogDTO> page, CommodityLogPageReq pageReq) {
    	String sql = new SQL() {{
            SELECT("t.id,t.commodity_id,t.commodity_name,t.original_status,t.status,t.original_approval_status,t.approval_status,t.gmt_create,t.create_id,t.gmt_modified,t.modified_id,t.is_deleted,t.is_deleted,t.modified_name ");
            FROM(" `ctshk-goods`.t_commodity_log t");
            WHERE("t.is_deleted = 0 ");
            if (null != pageReq.getCommodityId()) {
                WHERE("t.commodity_id = #{pageReq.commodityId} ");
            }
            ORDER_BY("t.gmt_create desc");
            }}.toString();
            return sql;
    }

    //========================== H5端 Start ==========================

    //========================== H5端 End ==========================
}
